package com.chinasoft.movie.quartz;

import com.chinasoft.movie.mapper.UserMapper;
import com.chinasoft.movie.util.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class SchedulerTask {
    @Autowired
    private UserMapper userMapper;
    private int count = 0;
    @Scheduled(cron = "0 32 14 * * ?")
    //0 5 3 * * ?：每天 3 点 5 分执行；

    //每天固定的一个时间点去触发这个事件
    private void process(){
        //System.out.println("this is scheduler task running " + (count++));
        List<Map<String,Object>> list=userMapper.selectVideoList();
        Map<String,Object> map=(Map<String,Object>)list.get(0);
        ToolUtil.videoMap.put("videoInfo",map);
        System.out.println("ok");
    }
}
